import React from 'react';
import { connect } from 'dva';
import { routerRedux } from 'dva/router';
import { NavBar, Icon } from 'antd-mobile';

const Example = (name,id,sex) => {
  return (
    <div>
      <NavBar leftContent="back"
        mode="light"
        onLeftClick={() => console.log('onLeftClick')}
        rightContent={[
          <Icon key="0" type="search" style={{ marginRight: '0.32rem' }} />,
          <Icon key="1" type="ellipsis" />,
        ]}
      >NavBar</NavBar>
      <NavBar leftContent="back"
        mode="dark"
        onLeftClick={() => routerRedux.push('/list')}
        rightContent={[
          <Icon key="0" type="search" style={{ marginRight: '0.32rem' }} />,
          <Icon key="1" type="ellipsis" />,
        ]}
      >NavBar</NavBar>
    </div>
  );
};

Example.propTypes = {
};

function mapStateToProps(state) {
  console.log(state);
   const { name, id, sex } = state.example0.users;
   return {
     name,
     id,
     sex,
   };
}

export default connect(mapStateToProps)(Example);
